package com.tanhua.common.utils;

import com.tanhua.common.pojo.User;

public class UserThreadLocal {
private static final ThreadLocal<User> LOCAL=new ThreadLocal<>();
private UserThreadLocal(){}

    /**
     * J将对象昂入到threadlocal
     * @param user
     */
    public static void  set(User user){LOCAL.set(user);}

    /**
     * 获取当前线程中的user对象
     * @return
     */
    public static User get(){
     return LOCAL.get();
}

    /**
     * 删除当前线程中的user对象 释放内存
     */
    public static void remove(){
        LOCAL.remove();
}

}